package org.siqisource.webstart.core.taglibs;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

public class JspNamespaceTag  extends TagSupport {

	public int doStartTag() throws JspTagException {
		HttpServletRequest request =
		          (HttpServletRequest)pageContext.getRequest();
		String currUri = request.getRequestURI();
		
		String namespace = currUri.replaceAll("/", "_");
		namespace = namespace.replace(".", "_");
		namespace += "_";
		
		request.setAttribute("jspns", namespace);
		return Tag.SKIP_BODY;
	}

	public int doEndTag() throws JspTagException {
		return Tag.EVAL_PAGE;
	}
}